package com.atguigu.gmallpublisher.service;

import com.alibaba.fastjson.JSONObject;
import com.atguigu.gmallpublisher.beans.DAUHour;
import com.atguigu.gmallpublisher.beans.GMVHour;
import com.atguigu.gmallpublisher.esdao.ESDaoImp;
import com.atguigu.gmallpublisher.mapper.GMVMapper;
import com.atguigu.gmallpublisher.mapper.PublisherMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.io.IOException;
import java.util.List;

@Service
public class PublisherServiceImp implements PublisherService{
    @Autowired
    PublisherMapper publisherMapper;

    @Autowired
    GMVMapper gmvMapper;

    @Autowired
    ESDaoImp esDao;

    @Override
    public Integer getDauByDate(String date) {
        return publisherMapper.getDauByDate(date);
    }

    @Override
    public Integer getNewMidCountByDate(String date) {
        return publisherMapper.getNewMidCountByDate(date);
    }

    @Override
    public List<DAUHour> getHourDAUNum(String date) {
        return publisherMapper.getHourDAUNum(date);
    }

    @Override
    public Double getTotalAmountByDate(String date) {
        return gmvMapper.getTotalAmountByDate(date);
    }

    @Override
    public List<GMVHour> getHourOrderAmount(String date) {
        return gmvMapper.getHourOrderAmount(date);
    }

    @Override
    public JSONObject getOrderDetail(String date, Integer startpage, Integer size, String keyword) throws IOException {
        return esDao.getOrderDetail(date,startpage,size,keyword);
    }


}
